package rsj.api.product;

import com.rlyy.aibase.utils.base.Box;
import com.rlyy.aibase.utils.base.MapNode;
import com.rlyy.aibase.utils.base.ThinkException;
import common.util.BoxUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import rsj.api.org.entity.UsageReportParam;
import rsj.api.user.BaseLink;
import rsj.service.export.IExportTemplateMethod;
import common.util.validator.ParameterConversionCheck;

/**
 * @author yuanqinglong
 * @since 2021/6/2 17:54
 */
@RestController
public class TestOomController extends BaseLink {

    @Autowired
    private IExportTemplateMethod testOom;

    @Override
    @RequestMapping(value = "rsj_test_oom")
    public Box executeLink(Box in) throws ThinkException {
        UsageReportParam dataEntity = (UsageReportParam) ParameterConversionCheck.parameterConversionCheckFastFail(in, UsageReportParam.class, UsageReportParam.ProdUidNotNull.class);
        MapNode mapNode = testOom.performExport(dataEntity, testOom);
        return BoxUtil.successBox(in).putMapNode("data", mapNode);
    }
}
